package org.crh.appointment.config;

/**
 * @description:
 * @author: RenHai Chen
 * @date: 2025/4/3 17:29
 */

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RocketMQConfig {

    @Value("${spring.rocketmq.name-server}")
    private String nameServer;

    @Bean
    public RocketMQTemplate rocketMQTemplate() {
        RocketMQTemplate template = new RocketMQTemplate();
        DefaultMQProducer producer = new DefaultMQProducer("appointment-service-group");
        producer.setNamesrvAddr(nameServer);
        template.setProducer(producer);
        return template;
    }
}
